<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/resources/jstl_contexpath.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>虎丘婚纱城管理系统</title>
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/bs3/css/bootstrap.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/bootstrap-reset.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/font-awesome/css/font-awesome.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/clndr.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style-responsive.css" />" />

    <!-- start: CSS -->
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/bootstrap.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/style.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/retina.min.css" />" />
    <!-- end: CSS -->

    <!-- start: Favicon and Touch Icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<c:url value="/resources/assets/ico/apple-touch-icon-144-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<c:url value="/resources/assets/ico/apple-touch-icon-114-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<c:url value="/resources/assets/ico/apple-touch-icon-72-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="<c:url value="/resources/assets/ico/apple-touch-icon-57-precomposed.png" />" />
    <link rel="shortcut icon" href="<c:url value="/resources/assets/ico/favicon.png" />" />
    <!-- end: Favicon and Touch Icons -->

</head>
<body>

<!-- start: Header -->
<%@ include file="/resources/head.jsp" %>
<!-- end: Header -->

<div class="container">
    <div class="row">
        <!-- start: Main Menu -->
        <%@ include file="/resources/sidebar.jsp" %>
        <!-- end: Main Menu -->

        <!-- start: Content -->
        <div id="content" class="col-lg-10 col-sm-11" style="min-height: 1000px">
            <div class="row">
                <div class="col-lg-12">
                    <div class="box">
                        <div class="box-header">
                            <h2><i class="fa fa-align-justify"></i><span class="break"></span>新增活动</h2>
                            <div class="box-icon">
                            </div>
                        </div>
                        <div class="box-content">
                            <form class="form-horizontal" role="form" id="file_upload_id" name="file_upload_name" action="${ctx}/manage/activity/doadd" method="post" enctype="multipart/form-data">
                                <input type="hidden" name="templet_id" id="templet_id" value="${templet_id}" />
                                <div class="form-group has-success">
                                    <label class="control-label" >活动名称</label>
                                    <input type="text" class="form-control" id="activity_name" name="activity_name" />
                                    <label class="control-label" >活动类型</label>
                                    <div class="controls">
                                        <select id="activity_type" name="activity_type" class="form-control">
                                            <option value="0">报名</option>
                                        </select>
                                    </div>
                                    <label class="control-label" >活动标题</label>
                                    <input type="text" class="form-control" id="title" name="title" />
                                    <label class="control-label" >活动简介</label>
                                    <input type="text" class="form-control" id="desc" name="desc" />
                                    <label class="control-label">活动详情</label>
                                    <div class="controls">
                                        <textarea id="activity_content" name="activity_content" rows="7" style="width: 100%"></textarea>
                                    </div>
                                    <label class="control-label" >活动流程（以中文"，"分隔，如：CEO致词，领导讲话，活动开始）</label>
                                    <input type="text" class="form-control" id="flow" name="flow" />
                                    <label class="control-label" >活动开始时间（格式：2016-11-15 09:00:00）</label>
                                    <input type="text" class="form-control" id="begin_time" name="begin_time" />
                                    <label class="control-label" >活动结束时间（格式：2016-11-31 21:00:00）</label>
                                    <input type="text" class="form-control" id="end_time" name="end_time" />
                                    <label class="control-label" >活动地点</label>
                                    <input type="text" class="form-control" id="address" name="address" />
                                    <label class="control-label" >活动封面（活动封面尺寸为208*156，请勿上传其他尺寸）</label>
                                    <div class="controls">
                                        <div class="input-group date col-sm-4">
                                            <input type="file" name="file_upload" id="file_upload" />
                                        </div>
                                    </div>
                                    <label class="control-label">选择渠道</label>
                                    <div class="controls">
                                        <label>
                                            <c:forEach var="channel" items="${channel_list}" varStatus="status">
                                                <input type="checkbox" name="channel_ids" id="${channel.id}" value="${channel.id}" />&nbsp;&nbsp;${channel.name}&nbsp;&nbsp;&nbsp;&nbsp;
                                            </c:forEach>
                                        </label>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn btn-primary" id="save">保存</button>
                                    <button type="button" class="btn" id="cancel">取消</button>
                                </div>

                            </form>
                        </div>
                    </div>
                </div><!--/col-->
            </div>
        </div>
    </div>
</div>
<%@ include file="/resources/managerfoot.jsp"%>

<!-- start: JavaScript-->
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-2.1.0.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-migrate-1.2.1.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/bootstrap.min.js" />" ></script>

<!-- page scripts -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-ui-1.10.3.custom.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery.sparkline.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery.dataTables.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/dataTables.bootstrap.min.js" />" ></script>

<!-- theme scripts -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/custom.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/core.min.js" />" ></script>

<!-- inline scripts related to this page -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/pages/table.js" />" ></script>

<!-- end: JavaScript-->

<script>
    $(function () {
        $('#cancel').click(function(){
            window.location.href="${ctx}/manage/activity/choosetemp";
        });
        $('#save').click(function(){
            var choose_channel_id = '';
            $('input[name="channel_ids"]:checked').each(function(){
                if(choose_channel_id == '') {
                    choose_channel_id = $(this).val();
                } else {
                    choose_channel_id = choose_channel_id + "," + $(this).val();
                }
            });
            if(choose_channel_id == '') {
                alert("请选择投放渠道！");
                return false;
            }

            var file = $('#file_upload').val();
            if(file == '') {
                alert("请上传活动封面");
                return false;
            }

            var activity_name = $('#activity_name').val();
            if(activity_name == '') {
                alert("请输入活动名称");
                return false;
            }

            var title = $('#title').val();
            if(title == '') {
                alert("请输入活动标题");
                return false;
            }

            var desc = $('#desc').val();
            if(desc == '') {
                alert("请输入活动简介");
                return false;
            }

            var activity_content = $('#activity_content').val();
            if(activity_content == '') {
                alert("请输入活动详情");
                return false;
            }

            var flow = $('#flow').val();
            if(flow == '') {
                alert("请输入活动流程");
                return false;
            }

            var begin_time = $('#begin_time').val();
            if(begin_time == '') {
                alert("请输入活动开始时间");
                return false;
            }

            var end_time = $('#end_time').val();
            if(end_time == '') {
                alert("请输入活动结束时间");
                return false;
            }

            var address = $('#address').val();
            if(address == '') {
                alert("请输入活动地点");
                return false;
            }

            $('#file_upload_id').submit();
        })
    });
</script>
</body>
</html>